from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    HostViewSet, HostGroupViewSet, ProjectViewSet,
    EnvironmentViewSet, UserViewSet, UserGroupViewSet
)
from .auth_views import register, login, user_info, logout

router = DefaultRouter()
router.register(r'hosts', HostViewSet, basename='host')
router.register(r'host-groups', HostGroupViewSet, basename='hostgroup')
router.register(r'projects', ProjectViewSet, basename='project')
router.register(r'environments', EnvironmentViewSet, basename='environment')
router.register(r'users', UserViewSet, basename='user')
router.register(r'user-groups', UserGroupViewSet, basename='usergroup')

urlpatterns = [
    path('', include(router.urls)),
    path('auth/register/', register, name='register'),
    path('auth/login/', login, name='login'),
    path('auth/logout/', logout, name='logout'),
    path('auth/user/', user_info, name='user_info'),
]
